home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / houCons.dxr / interface_489_BuildMatDisplayArrows behave.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  2.4 KB  |  98 lines

  1. property mySprite, myTargetSprite, myType, myName, myNameDown, myNameOver, myNameInactive, myAction, Active, ancestor, grey
  2.  
  3. on beginSprite me
  4.   global gActorListMan
  5.   mySprite = me.spriteNum
  6.   myName = (the member of sprite mySprite).name
  7.   myNameDown = word 1 of myName && "down"
  8.   myNameOver = word 1 of myName && "over"
  9.   myNameInactive = word 1 of myName && "Inactive"
  10.   Active = 1
  11.   if myName starts "right" then
  12.     myAction = #next
  13.   else
  14.     myAction = #prev
  15.     goGrey(me)
  16.   end if
  17.   lookForToolTip = 1
  18.   ancestor = new(script("FourStatebuttonActions"), lookForToolTip)
  19.   myType = #BuildMatArrow
  20.   registerSprite(gActorListMan, mySprite)
  21. end
  22.  
  23. on mouseUp me
  24.   global gClickSprite
  25.   if voidp(myTargetSprite) then
  26.     myTargetSprite = sendAllSprites(#sendSpriteNum, #BuildMatDisplay)
  27.   end if
  28.   if not Active then
  29.     exit
  30.   end if
  31.   if gClickSprite = mySprite then
  32.     doButtonUpClick(myType)
  33.     if myAction = #next then
  34.       result = sendSprite(myTargetSprite, #doNextDisplay)
  35.     else
  36.       result = sendSprite(myTargetSprite, #doPreviousDisplay)
  37.     end if
  38.     curBuildMatStatus = sendSprite(myTargetSprite, #getCurDisplayStatus)
  39.     sendAllSprites(#updateBuildMatArrowStates, curBuildMatStatus)
  40.   end if
  41. end
  42.  
  43. on updateBuildMatArrowStates me, curBuildMatStatus
  44.   outPut("Sprite " && mySprite && "got <updateBuildMatArrowStates>")
  45.   outPut("curBuildMatStatus =" && curBuildMatStatus)
  46.   case curBuildMatStatus of
  47.     #First:
  48.       if myAction = #prev then
  49.         goGrey(me)
  50.       else
  51.         goActive(me)
  52.       end if
  53.     #last:
  54.       if myAction = #next then
  55.         goGrey(me)
  56.       else
  57.         goActive(me)
  58.       end if
  59.     #mid:
  60.       if grey then
  61.         goActive(me)
  62.       end if
  63.   end case
  64. end
  65.  
  66. on goGrey me
  67.   global gCursorMan
  68.   Active = 0
  69.   grey = 1
  70.   set the member of sprite mySprite to member(myNameInactive)
  71.   if rollover() = mySprite then
  72.     setCursor(gCursorMan, #Arrow, myType)
  73.   end if
  74. end
  75.  
  76. on goActive me
  77.   Active = 1
  78.   grey = 0
  79.   set the member of sprite mySprite to member(myName)
  80. end
  81.  
  82. on clearActorList me
  83.   refreshBuildMatArrowStates(me)
  84. end
  85.  
  86. on refreshBuildMatArrowStates me
  87.   if voidp(myTargetSprite) then
  88.     myTargetSprite = sendAllSprites(#sendSpriteNum, #BuildMatDisplay)
  89.   end if
  90.   curDisplayStatus = sendSprite(myTargetSprite, #getCurDisplayStatus)
  91.   sendAllSprites(#updateBuildMatArrowStates, curDisplayStatus)
  92. end
  93.  
  94. on endSprite me
  95.   global gActorListMan
  96.   unRegisterSprite(gActorListMan, mySprite)
  97. end
  98.